package cn.wgx.commons.interceptor;

import cn.hutool.core.util.NumberUtil;
import cn.wgx.commons.exception.cn.TooFastRequestException;
import cn.wgx.commons.util.Servlets;
import cn.wgx.commons.util.SpringContextHolder;
import cn.wgx.modules.sys.util.UserUtil;
import io.swagger.models.auth.In;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.Serializable;
import java.util.concurrent.TimeUnit;

/**
 * 参数过滤器
 *
 */
public class ParamFilter implements HandlerInterceptor {




    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        String pageSize = request.getParameter("pageSize");
        if(pageSize != null){
            if(NumberUtil.isInteger(pageSize)){
                Integer p = Integer.parseInt(pageSize);
                request.getParameterMap();
            }
        }
        return true;
    }

    @Override
    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {

    }

    @Override
    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {

    }
}
